package com.jl.jlapp.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jl.jlapp.R;
import com.jl.jlapp.eneity.ShoppingCartModel;

import java.util.List;

public class WriteOrderGoodsMsgAdapter
        extends BaseQuickAdapter<ShoppingCartModel.ResultDataBean, BaseViewHolder> {
    int buyNum = 0;
    int isFromGoodsDetail = 0;

    public WriteOrderGoodsMsgAdapter(int paramInt, @Nullable List<ShoppingCartModel.ResultDataBean> paramList) {
        super(paramInt, paramList);
    }

    protected void convert(BaseViewHolder paramBaseViewHolder, ShoppingCartModel.ResultDataBean paramResultDataBean) {
        ImageView localImageView = (ImageView) paramBaseViewHolder.getView(R.id.iv_foods);
        RelativeLayout localRelativeLayout = (RelativeLayout) paramBaseViewHolder.getView(R.id.shop_cart_list_item_change_num);
        TextView localTextView1 = (TextView) paramBaseViewHolder.getView(R.id.tv_reduce);
        TextView localTextView2 = (TextView) paramBaseViewHolder.getView(R.id.tv_add);
        TextView localTextView3 = (TextView) paramBaseViewHolder.getView(R.id.from_goods_msg_num);
        localRelativeLayout.setVisibility(View.VISIBLE);
        localTextView3.setVisibility(View.GONE);
        if (this.isFromGoodsDetail == 0) {
            localRelativeLayout.setVisibility(View.GONE);
            localTextView3.setVisibility(View.VISIBLE);
            localTextView3.setText("x " + paramResultDataBean.getGoodsNum());
        }
        Glide.with(paramBaseViewHolder.itemView.getContext()).asBitmap().apply(new RequestOptions().placeholder(R.drawable.img_noimg_xs).error(R.drawable.img_lose_xs)).load("http://117.158.178.202:8001/JLMIS/" + paramResultDataBean.getGoodsPicUrl()).into(localImageView);
        paramBaseViewHolder.setText(R.id.tv_foods_name, paramResultDataBean.getGoodsName());
        paramBaseViewHolder.setText(R.id.tv_food_number, paramResultDataBean.getGoodsSpecificationDetailsName());
        paramBaseViewHolder.setText(R.id.tv_foods_prices, paramResultDataBean.getGoodsUnitlPrice() + "");
        paramBaseViewHolder.setText(R.id.shop_cart_goods_buy_num, paramResultDataBean.getGoodsNum() + "");
        if ((paramResultDataBean.getGoodsDetails() != null) && (paramResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().size() > 0)) {
            int i = 0;
            if (i < paramResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().size()) {
                if (((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) paramResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().get(i)).getId() == paramResultDataBean.getGoodsSpecificationDetailsId()) {
                    if (paramResultDataBean.getGoodsNum() <= 1) {
                    }
                    localTextView1.setTextColor(paramBaseViewHolder.itemView.getResources().getColor(R.color.trans_333333));
                    if ((paramResultDataBean.getGoodsDetails().getZeroStock().intValue() != 0) || (((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) paramResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().get(i)).getGxcGoodsState() != 2)) {
                    }
                    if (paramResultDataBean.getGoodsNum() < ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) paramResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().get(i)).getGxcGoodsStock()) {
                    }
                    localTextView2.setTextColor(paramBaseViewHolder.itemView.getResources().getColor(R.color.moreText));
                } else {
                    if (paramResultDataBean.getGoodsNum() >= 500) {
                        localTextView2.setTextColor(paramBaseViewHolder.itemView.getResources().getColor(R.color.moreText));
                    }
                    i += 1;
                    localTextView1.setTextColor(paramBaseViewHolder.itemView.getResources().getColor(R.color.moreText));
                    localTextView2.setTextColor(paramBaseViewHolder.itemView.getResources().getColor(R.color.trans_333333));
                    localTextView2.setTextColor(paramBaseViewHolder.itemView.getResources().getColor(R.color.trans_333333));
                }
            }
        }
        paramBaseViewHolder.addOnClickListener(R.id.tv_add);
        paramBaseViewHolder.addOnClickListener(R.id.tv_reduce);
        paramBaseViewHolder.addOnClickListener(R.id.shop_cart_goods_buy_num);
    }

    public void setBuyNum(int paramInt) {
        this.buyNum = paramInt;
    }

    public void setIsFromGoodsDetail(int paramInt) {
        this.isFromGoodsDetail = paramInt;
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/adapter/WriteOrderGoodsMsgAdapter.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */